###############################################################################
# Variable definitions for targets to build
###############################################################################
#___INFO__MARK_BEGIN__
##########################################################################
#
#  The Contents of this file are made available subject to the terms of
#  the Sun Industry Standards Source License Version 1.2
#
#  Sun Microsystems Inc., March, 2001
#
#
#  Sun Industry Standards Source License Version 1.2
#  =================================================
#  The contents of this file are subject to the Sun Industry Standards
#  Source License Version 1.2 (the "License"); You may not use this file
#  except in compliance with the License. You may obtain a copy of the
#  License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
#
#  Software provided under this License is provided on an "AS IS" basis,
#  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
#  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
#  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
#  See the License for the specific provisions governing your rights and
#  obligations concerning the Software.
#
#  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
#  Copyright: 2001 by Sun Microsystems, Inc.
#
#  All Rights Reserved.
#
##########################################################################
#___INFO__MARK_END__
DAEMONS_COMMON_DIR = $(SDIR)/daemons/common

DAEMONS_COMMON_SRC = admin_mail.c \
                    category.c \
                    err_trace.c \
                    lock.c \
                    mail.c \
                    qlogin_starter.c \
                    qmaster_heartbeat.c \
                    setosjobid.c \
                    shutdown.c \
                    startprog.c \
                    unparse_job_cull.c \
                    sge_processes_irix.c \
                    pdc.c \
                    procfs.c \
                    binding_support.c

DAEMONS_COMMON_TEST_OBJS = \
              test_category.o \
              test_heartbeat.o

DAEMONS_COMMON_TEST_PROGS = \
              test_category \
              test_heartbeat

DAEMONS_COMMON_OBJS = $(DAEMONS_COMMON_SRC:.c=.o)

DAEMONS_COMMON_PDC_TARGETS = pdc

DAEMONS_COMMON_PDC_OBJS = pdc_main.o \
               procfs_main.o
###############################################################################
# global rules: all, clean, depend, messages
###############################################################################
daemons_common: $(DAEMONS_COMMON_OBJS) $(DAEMONS_COMMON_TEST_PROGS) $(DAEMONS_COMMON_PDC_TARGETS)

daemons_common_clean:
	$(RM) $(DAEMONS_COMMON_OBJS) $(DAEMONS_COMMON_TEST_OBJS) $(DAEMONS_COMMON_TEST_PROGS) $(DAEMONS_COMMON_PDC_TARGETS) $(DAEMONS_COMMON_PDC_OBJS)

daemons_common_depend:
	$(DEPEND) -f$(DAEMONS_COMMON_DIR)/common_dependencies $(DAEMONS_COMMON_DIR)/*.c

daemons_common_messages:
	@echo Creating $@
	@for i in `ls $(DAEMONS_COMMON_DIR)/*.c`; do \
	   $(CC) $(CFLAGS) -DEXTRACT_MESSAGES -E $$i | $(XGETTEXT) - ; \
	done

###############################################################################
# rules to build binaries
###############################################################################

test_category:	test_category.o category.o unparse_job_cull.o $(WINGRIDLIB_DEP) $(SCHEDLIB) $(SGEOBJLIB) $(SGEOBJDLIB) $(COMMLIB) $(COMMLISTSLIB) $(CULLLIB) $(UTILIB)  
		$(LD_WRAPPER) $(CC) -o $@ $(LFLAGS) test_category.o category.o unparse_job_cull.o $(SCHEDLIB) $(SGEOBJLIB) $(COMMLIB) $(COMMLISTSLIB) $(SGEOBJDLIB) $(CULLLIB) $(UTILIB) $(WINGRIDLIB) $(DLLIB) $(SECLIB) $(SLIBS) $(LIBS)
test_heartbeat:	test_heartbeat.o qmaster_heartbeat.o $(WINGRIDLIB_DEP) $(UTILIB) $(COMMLISTSLIB)  
		$(LD_WRAPPER) $(CC) -o $@ $(LFLAGS) test_heartbeat.o qmaster_heartbeat.o $(UTILIB) $(WINGRIDLIB) $(COMMLISTSLIB) $(DLLIB) $(SLIBS) $(LIBS) 

pdc:  $(DAEMONS_COMMON_PDC_OBJS) $(SGEOBJLIB) $(CULLLIB) $(SGEOBJDLIB) $(COMMLIB) $(SCHEDLIB) $(COMMLISTSLIB) $(SGEOBJDLIB) $(UTILIB) $(UTI2LIB) $(WINGRIDLIB) $(DLLIB) $(SECLIB)
		$(LD_WRAPPER) $(CC) -o $@ $(LFLAGS) $(DAEMONS_COMMON_PDC_OBJS) $(SCHEDLIB) $(SGEOBJLIB) $(COMMLIB) $(COMMLISTSLIB) $(SGEOBJDLIB) $(CULLLIB) $(UTILIB) $(UTI2LIB) $(WINGRIDLIB) $(DLLIB) $(SECLIB) $(SLIBS) $(LIBS)
###############################################################################
# include dependencies for object files generated by sge_depend
###############################################################################
include $(DAEMONS_COMMON_DIR)/common_dependencies

###############################################################################
# rules to build object codes
###############################################################################
admin_mail.o : $(DAEMONS_COMMON_DIR)/admin_mail.c
		$(CC) $(CFLAGS) $(MEMCFLAG) -c $(DAEMONS_COMMON_DIR)/admin_mail.c

category.o:	$(DAEMONS_COMMON_DIR)/category.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/category.c

err_trace.o:	$(DAEMONS_COMMON_DIR)/err_trace.c
		$(CC) -I$(DAEMONS_COMMON_DIR) $(CFLAGS) $(MEMCFLAG) -c $(DAEMONS_COMMON_DIR)/err_trace.c

lock.o: 	$(DAEMONS_COMMON_DIR)/lock.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/lock.c

mail.o:		$(DAEMONS_COMMON_DIR)/mail.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/mail.c

qlogin_starter.o: $(DAEMONS_COMMON_DIR)/qlogin_starter.c
		$(CC) -I$(DAEMONS_COMMON_DIR) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/qlogin_starter.c

qmaster_heartbeat.o: $(DAEMONS_COMMON_DIR)/qmaster_heartbeat.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/qmaster_heartbeat.c

setosjobid.o: $(DAEMONS_COMMON_DIR)/setosjobid.c
		$(CC) -I$(DAEMONS_COMMON_DIR) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/setosjobid.c

shutdown.o   : $(DAEMONS_COMMON_DIR)/shutdown.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/shutdown.c

startprog.o   : $(DAEMONS_COMMON_DIR)/startprog.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/startprog.c

unparse_job_cull.o: 	$(DAEMONS_COMMON_DIR)/unparse_job_cull.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/unparse_job_cull.c

sge_processes_irix.o: 	$(DAEMONS_COMMON_DIR)/sge_processes_irix.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/sge_processes_irix.c

pdc_main.o: 	$(DAEMONS_COMMON_DIR)/pdc.c
		$(CC) $(CFLAGS) -DMONITOR_PDC -DPDC_STANDALONE $(MEMCFLAG) $(GCCC_NOERR_FLAGS) -c $(DAEMONS_COMMON_DIR)/pdc.c -o pdc_main.o

procfs_main.o: 	$(DAEMONS_COMMON_DIR)/procfs.c
		$(CC) $(CFLAGS) -DMONITOR_PDC -DPDC_STANDALONE $(MEMCFLAG) -c $(DAEMONS_COMMON_DIR)/procfs.c -o procfs_main.o

pdc.o: 	$(DAEMONS_COMMON_DIR)/pdc.c
		$(CC) $(CFLAGS) $(MEMCFLAG) $(GCCC_NOERR_FLAGS) -c $(DAEMONS_COMMON_DIR)/pdc.c

procfs.o: 	$(DAEMONS_COMMON_DIR)/procfs.c
		$(CC) $(CFLAGS) $(MEMCFLAG) -c $(DAEMONS_COMMON_DIR)/procfs.c

binding_support.o: 	$(DAEMONS_COMMON_DIR)/binding_support.c
		$(CC) $(CFLAGS) $(MEMCFLAG) -c $(DAEMONS_COMMON_DIR)/binding_support.c

test_category.o : $(DAEMONS_COMMON_DIR)/test_category.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/test_category.c

test_heartbeat.o : $(DAEMONS_COMMON_DIR)/test_heartbeat.c
		$(CC) $(CFLAGS) -c $(DAEMONS_COMMON_DIR)/test_heartbeat.c


